package com.xd.navi;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * 线程控制器
 */
public class ThreadManager {
    private ThreadManager() {
    }

    private static final class ThreadManagerHolder {
        private static ThreadManager instance = new ThreadManager();
    }

    public static ThreadManager getInstance() {
        return ThreadManagerHolder.instance;
    }

    private ExecutorService mCachedThreadService = Executors.newCachedThreadPool();

    public void addNewRunnable(Runnable runnable) {
        mCachedThreadService.execute(runnable);
    }
}
